<?php
/**
 * Created by PhpStorm.
 * User: ASUS
 * Date: 2021/12/6
 * Time: 21:05
 */
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>头像上传成功</title>
</head>
<body>
<h1>个人中心</h1>
<?php
$oldName = $_FILES['file']['name'];
//echo $oldName;
$arr = explode('.',$oldName);
$newName = md5($oldName.time()).'.'.$arr[count($arr)-1];
move_uploaded_file($_FILES['file']['tmp_name'],'photo/'.$newName);
$photo_url = 'photo/'.$newName;
?>
上传的头像：
<img src="<?php echo $photo_url; ?>">
</body>
</html>